package com.sdutcm.xuake.xuanke_demo.controller;

import com.sdutcm.xuake.xuanke_demo.bean.GuaKeInfo;
import com.sdutcm.xuake.xuanke_demo.service.GuaKeService;
import com.sdutcm.xuake.xuanke_demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @author 小浩
 * @date 2018-09-20 01:32
 * @package com.sdutcm.xuake.xuanke_demo.controller
 * @description
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    UserService userService;
    @Autowired
    GuaKeService guaKeService;
    @RequestMapping("/login")
    public boolean login(int xuehao,String password){
        return userService.login(xuehao,password);
    }


    @RequestMapping("/update")
    public boolean updatePassword(int xuehao,String password){
        return userService.updatePassword(xuehao,password);
    }

    @RequestMapping("/guake")
    public List<GuaKeInfo> getGuaKe(int xuehao){
        return  guaKeService.getByXueHao(xuehao);
    }
}
